<?php

/**
 * This is the model class for table "{{companymaster}}".
 *
 * The followings are the available columns in table '{{companymaster}}':
 * @property string $idcompanymaster
 * @property string $companyname
 * @property string $companyadd
 * @property string $companycity
 * @property string $companystate
 * @property string $companyphone
 * @property string $companyemail
 * @property string $idfinyear
 * @property string $bookbeginfrom
 * @property string $companyit
 * @property string $companytinstate
 * @property string $companytinindia
 * @property string $username
 * @property string $password
 */
class Companymaster extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Companymaster the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{companymaster}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('companyname, companyadd', 'length', 'max'=>100),
			array('companycity, companystate', 'length', 'max'=>50),
			array('companyphone, companyemail', 'length', 'max'=>45),
			array('idfinyear, companyit, companytinstate, companytinindia', 'length', 'max'=>20),
			array('username, password', 'length', 'max'=>10),
			array('bookbeginfrom', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('idcompanymaster, companyname, companyadd, companycity, companystate, companyphone, companyemail, idfinyear, bookbeginfrom, companyit, companytinstate, companytinindia, username, password', 'safe', 'on'=>'search'),
		);
	}        
        
       
        
        
	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'idcompanymaster' => Yii::t('application', 'Idcompanymaster'),
			'companyname' => Yii::t('application', 'Companyname'),
			'companyadd' => Yii::t('application', 'Companyadd'),
			'companycity' => Yii::t('application', 'Companycity'),
			'companystate' => Yii::t('application', 'Companystate'),
			'companyphone' => Yii::t('application', 'Companyphone'),
			'companyemail' => Yii::t('application', 'Companyemail'),
			'idfinyear' => Yii::t('application', 'Idfinyear'),
			'bookbeginfrom' => Yii::t('application', 'Bookbeginfrom'),
			'companyit' => Yii::t('application', 'Companyit'),
			'companytinstate' => Yii::t('application', 'Companytinstate'),
			'companytinindia' => Yii::t('application', 'Companytinindia'),
			'username' => Yii::t('application', 'Username'),
			'password' => Yii::t('application', 'Password'),
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('idcompanymaster',$this->idcompanymaster,true);
		$criteria->compare('companyname',$this->companyname,true);
		$criteria->compare('companyadd',$this->companyadd,true);
		$criteria->compare('companycity',$this->companycity,true);
		$criteria->compare('companystate',$this->companystate,true);
		$criteria->compare('companyphone',$this->companyphone,true);
		$criteria->compare('companyemail',$this->companyemail,true);
		$criteria->compare('idfinyear',$this->idfinyear,true);
		$criteria->compare('bookbeginfrom',$this->bookbeginfrom,true);
		$criteria->compare('companyit',$this->companyit,true);
		$criteria->compare('companytinstate',$this->companytinstate,true);
		$criteria->compare('companytinindia',$this->companytinindia,true);
		$criteria->compare('username',$this->username,true);
		$criteria->compare('password',$this->password,true);

		return new CActiveDataProvider(get_class($this), array(
			'criteria'=>$criteria,
		));
	}
}